import 'package:flutter/material.dart';

///
/// 自定义Appbar
///
class QAppBar extends AppBar {
  QAppBar({
    Key? key,
    required BuildContext buildContext,
    required TabBar tabBar,
    String? title, // 标题
    double fontSize = 16, // 标题文字大小
    FontWeight fontWeight = FontWeight.normal, // 标题文字粗细
    String? backImg,
    Color? backIconColor,
    List<Widget>? rightWidgets,
    bool isOpenCallBack = false,
    Function? backCallBack,
  }) : super(
          key: key,
          title: Title(
            color: Colors.white,
            child: Text(
              title ?? "标题",
              style: TextStyle(
                  fontSize: fontSize,
                  fontWeight: fontWeight,
                  color: Colors.black),
            ),
          ),
          backgroundColor: Colors.white,
          leading: GestureDetector(
            onTap: () {
              Navigator.pop(buildContext);
              if (isOpenCallBack) {
                backCallBack!();
              }
            },
            child: Container(
              padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 14),
              child: Icon(
                Icons.arrow_back_ios,
                size: 22,
                color: backIconColor ?? Colors.black,
              ),
            ),
          ),
          actions: rightWidgets,
          bottom: tabBar,
        );
}
